package org.dei.perla.rockfall.gui.queryforge;

import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

class CommandPanel extends ReadableStatusPanel {

	private JCheckBox jCheckBox1;
	private JCheckBox jCheckBox2;
	
	protected CommandPanel(String title) {
		super(title);
	}

	@Override
	protected int getStatus() {
		int result = 0;
		if(jCheckBox1.isSelected()){
			result |= 0x1;
		}
		if(jCheckBox2.isSelected()){
			result |= 0x2;
		}
		return result;	
	}

	@Override
	protected void setStatus(int stato) {
		jCheckBox1.setSelected((stato & 0x1) > 0);
		jCheckBox2.setSelected((stato & 0x2) > 0);
	}

	@Override
	protected void setupInternalComponents() {
		
		//Primo blocco di scelte
		
		jCheckBox1 = new JCheckBox();
		JLabel jlabel1 = new JLabel("Abilita come master di sincronia");
		JPanel jpanel1 = new JPanel();
		jCheckBox1.setEnabled(false);
		BoxLayout layout1 = new BoxLayout(jpanel1, BoxLayout.X_AXIS);
		jpanel1.add(jlabel1);
		jpanel1.add(jCheckBox1);
		
		//Secondo blocco di scelte
		
		jCheckBox2 = new JCheckBox();
		JLabel jlabel2 = new JLabel("Abilita timeout su can");
		JPanel jpanel2 = new JPanel();
		jCheckBox2.setEnabled(false);
		BoxLayout layout2 = new BoxLayout(jpanel2, BoxLayout.X_AXIS);
		jpanel2.add(jlabel2);
		jpanel2.add(jCheckBox2);
		//aggiungo tutti i blocchi	
		this.add(jpanel1);
		this.add(jpanel2);
		
	}

}
